From 2822c0eb2e4523604c11edad8f83caeb9aa740ba Mon Sep 17 00:00:00 2001 From: robertl Date: Thu, 24 Jun 2004 17:18:52 +0000 Subject: [PATCH] Add gratituous casts for the benefit of a language we aren't even written in... --- gpsbabel/arcdist.c | 6 +++--- gpsbabel/defs.h | 9 +++++---- gpsbabel/duplicate.c | 2 +- gpsbabel/gpx.c | 2 +- gpsbabel/netstumbler.c | 4 ++-- gpsbabel/polygon.c | 8 ++++---- gpsbabel/position.c | 12 ++++++------ gpsbabel/smplrout.c | 4 ++-- gpsbabel/sort.c | 2 +- gpsbabel/xcsv.c | 12 ++++++------ 10 files changed, 31 insertions(+), 30 deletions(-) diff --git a/gpsbabel/arcdist.c b/gpsbabel/arcdist.c index 6ee80ef96..7ee828099 100644 --- a/gpsbabel/arcdist.c +++ b/gpsbabel/arcdist.c @@ -91,10 +91,10 @@ arcdist_process(void) dist = (((dist * 180.0 * 60.0) / M_PI) * 1.1516); if ( waypointp->extra_data ) { - ed = waypointp->extra_data; + ed = (extra_data *) waypointp->extra_data; } else { - ed = xcalloc(1, sizeof(*ed)); + ed = (extra_data *) xcalloc(1, sizeof(*ed)); ed->distance = BADVAL; } if ( ed->distance > dist ) { @@ -112,7 +112,7 @@ arcdist_process(void) QUEUE_FOR_EACH(&waypt_head, elem, tmp) { waypoint *wp = (waypoint *) elem; - ed = wp->extra_data; + ed = (extra_data *) wp->extra_data; wp->extra_data = NULL; if ( ed ) { if ((ed->distance >= pos_dist) == (exclopt == NULL)) { diff --git a/gpsbabel/defs.h b/gpsbabel/defs.h index 6a02fba50..b6d36c20f 100644 --- a/gpsbabel/defs.h +++ b/gpsbabel/defs.h @@ -256,6 +256,7 @@ void route_add (waypoint *); void route_add_wpt(route_head *rte, waypoint *wpt); void route_del_wpt(route_head *rte, waypoint *wpt); void route_add_head(route_head *rte); +void route_reverse(const route_head *rte_hd); void track_add_head(route_head *rte); void route_disp_all(route_hdr, route_trl, waypt_cb); void track_disp_all(route_hdr, route_trl, waypt_cb); @@ -382,13 +383,13 @@ void xfree(void *mem); char *xstrdup(const char *s); char *xstrndup(const char *s, size_t n); char *xstrndupt(const char *s, size_t n); -char *xstrappend(char *src, const char *new); +char *xstrappend(char *src, const char *addon); #define xxcalloc(nmemb, size, file, line) xcalloc(nmemb, size) #define xxmalloc(size, file, line) xmalloc(size) #define xxrealloc(p, s, file, line) xrealloc(p,s) #define xxfree(mem, file, line) xfree(mem) #define xxstrdup(s, file, line) xstrdup(s) -#define xxstrappend(src, new, file, line) xstrappend(src, new) +#define xxstrappend(src, addon, file, line) xstrappend(src, addon) #else /* DEBUG_MEM */ void *XCALLOC(size_t nmemb, size_t size, DEBUG_PARAMS ); void *XMALLOC(size_t size, DEBUG_PARAMS ); @@ -397,7 +398,7 @@ void XFREE(void *mem, DEBUG_PARAMS ); char *XSTRDUP(const char *s, DEBUG_PARAMS ); char *XSTRNDUP(const char *src, size_t size, DEBUG_PARAMS ); char *XSTRNDUPT(const char *src, size_t size, DEBUG_PARAMS ); -char *XSTRAPPEND(char *src, const char *new, DEBUG_PARAMS ); +char *XSTRAPPEND(char *src, const char *addon, DEBUG_PARAMS ); void debug_mem_open(); void debug_mem_output( char *format, ... ); void debug_mem_close(); @@ -408,7 +409,7 @@ void debug_mem_close(); #define xstrdup(s) XSTRDUP(s, __FILE__, __LINE__) #define xstrndup(s, z) XSTRNDUP(s, z, __FILE__, __LINE__) #define xstrndupt(s, z) XSTRNDUPT(s, z, __FILE__, __LINE__) -#define xstrappend(src,new) XSTRAPPEND(src, new, __FILE__, __LINE__) +#define xstrappend(src,addon) XSTRAPPEND(src, addon, __FILE__, __LINE__) #define xxcalloc XCALLOC #define xxmalloc XMALLOC #define xxrealloc XREALLOC diff --git a/gpsbabel/duplicate.c b/gpsbabel/duplicate.c index 9fc23bea1..7f11fac9b 100644 --- a/gpsbabel/duplicate.c +++ b/gpsbabel/duplicate.c @@ -174,7 +174,7 @@ duplicate_process(void) queue *elem, *tmp; extern queue waypt_head; - htable = xmalloc(ct * sizeof(*htable)); + htable = (wpt_ptr *) xmalloc(ct * sizeof(*htable)); bh = htable; i = 0; diff --git a/gpsbabel/gpx.c b/gpsbabel/gpx.c index 9b0fea6a3..7d70bcded 100644 --- a/gpsbabel/gpx.c +++ b/gpsbabel/gpx.c @@ -1,7 +1,7 @@ /* Access GPX data files. - Copyright (C) 2002 Robert Lipe, robertlipe@usa.net + Copyright (C) 2002, 2003, 2004 Robert Lipe, robertlipe@usa.net This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/gpsbabel/netstumbler.c b/gpsbabel/netstumbler.c index ef17d7715..487fc0c48 100644 --- a/gpsbabel/netstumbler.c +++ b/gpsbabel/netstumbler.c @@ -166,7 +166,7 @@ data_read(void) if (lat == 0 && lon == 0) /* skip records with no GPS data */ continue; - wpt_tmp = xcalloc(sizeof(*wpt_tmp), 1); + wpt_tmp = (waypoint *) xcalloc(sizeof(*wpt_tmp), 1); if (stealth) { if (!snmac) @@ -244,7 +244,7 @@ fix_netstumbler_dupes(void) unsigned long last_crc; char ssid[32 + 5 + 1]; - htable = xmalloc(ct * sizeof *htable); + htable = (htable_t *) xmalloc(ct * sizeof *htable); bh = htable; i = 0; diff --git a/gpsbabel/polygon.c b/gpsbabel/polygon.c index 3835f7de0..4d9e20752 100644 --- a/gpsbabel/polygon.c +++ b/gpsbabel/polygon.c @@ -217,13 +217,13 @@ polygon_process(void) waypointp = (waypoint *)elem; if ( waypointp->extra_data ) { - ed = waypointp->extra_data; + ed = (extra_data *) waypointp->extra_data; } else { - ed = xcalloc(1, sizeof(*ed)); + ed = (extra_data *) xcalloc(1, sizeof(*ed)); ed->state = OUTSIDE; ed->override = 0; - waypointp->extra_data = ed; + waypointp->extra_data = (extra_data *) ed; } if ( lat2 == waypointp->latitude && lon2 == waypointp->longitude ) { @@ -266,7 +266,7 @@ polygon_process(void) QUEUE_FOR_EACH(&waypt_head, elem, tmp) { waypoint *wp = (waypoint *) elem; - ed = wp->extra_data; + ed = (extra_data *) wp->extra_data; wp->extra_data = NULL; if ( ed ) { if ( ed->override ) ed->state = INSIDE; diff --git a/gpsbabel/position.c b/gpsbabel/position.c index e5273ed2e..fc436d6ee 100644 --- a/gpsbabel/position.c +++ b/gpsbabel/position.c @@ -109,8 +109,8 @@ dist_comp(const void * a, const void * b) { const waypoint *x1 = *(waypoint **)a; const waypoint *x2 = *(waypoint **)b; - extra_data *x1e = x1->extra_data; - extra_data *x2e = x2->extra_data; + extra_data *x1e = (extra_data *) x1->extra_data; + extra_data *x2e = (extra_data *) x2->extra_data; if (x1e->distance > x2e->distance) return 1; @@ -131,7 +131,7 @@ position_process(void) wc = waypt_count(); - comp = xcalloc(wc, sizeof(*comp)); + comp = (waypoint **) xcalloc(wc, sizeof(*comp)); i = 0; @@ -219,7 +219,7 @@ radius_process(void) continue; } - ed = xcalloc(1, sizeof(*ed)); + ed = (extra_data *) xcalloc(1, sizeof(*ed)); ed->distance = dist; waypointp->extra_data = ed; } @@ -227,7 +227,7 @@ radius_process(void) wc = waypt_count(); QUEUE_INIT(&temp_head); - comp = xcalloc(wc, sizeof(*comp)); + comp = (waypoint **) xcalloc(wc, sizeof(*comp)); i = 0; @@ -277,7 +277,7 @@ radius_init(const char *args) { } } - home_pos = xcalloc(sizeof(*home_pos), 1); + home_pos = (waypoint *) xcalloc(sizeof(*home_pos), 1); if (latopt) home_pos->latitude = atof(latopt); diff --git a/gpsbabel/smplrout.c b/gpsbabel/smplrout.c index ee24fa3f7..4015e008d 100644 --- a/gpsbabel/smplrout.c +++ b/gpsbabel/smplrout.c @@ -67,7 +67,7 @@ routesimple_waypt_pr( const waypoint *wpt ) { if ( !cur_rte ) return; xte_recs[xte_count].ordinal=xte_count; - xte_recs[xte_count].intermed = xmalloc( sizeof(struct xte_intermed)); + xte_recs[xte_count].intermed = (xte_intermed *) xmalloc( sizeof(struct xte_intermed)); xte_recs[xte_count].intermed->wpt = wpt; xte_recs[xte_count].intermed->xte_rec = xte_recs+xte_count; xte_recs[xte_count].intermed->next = NULL; @@ -125,7 +125,7 @@ routesimple_head( const route_head *rte ) /* short-circuit if we already have fewer than the max points */ if ( count >= rte->rte_waypt_ct) return; - xte_recs = xcalloc( rte->rte_waypt_ct, sizeof (struct xte)); + xte_recs = (xte *) xcalloc( rte->rte_waypt_ct, sizeof (struct xte)); cur_rte = rte; } diff --git a/gpsbabel/sort.c b/gpsbabel/sort.c index f84529a54..446688ea3 100644 --- a/gpsbabel/sort.c +++ b/gpsbabel/sort.c @@ -63,7 +63,7 @@ sort_process(void) wc = waypt_count(); - comp = xcalloc(wc, sizeof(*comp)); + comp = (waypoint **) xcalloc(wc, sizeof(*comp)); QUEUE_FOR_EACH(&waypt_head, elem, tmp) { comp[i] = (waypoint *)elem; diff --git a/gpsbabel/xcsv.c b/gpsbabel/xcsv.c index 116dd53a3..3ffb50efa 100644 --- a/gpsbabel/xcsv.c +++ b/gpsbabel/xcsv.c @@ -211,11 +211,11 @@ xcsv_parse_style_line(const char *sbuff) /* field delimiters are always bad characters */ if (xcsv_file.badchars) { - xcsv_file.badchars = xrealloc(xcsv_file.badchars, + xcsv_file.badchars = (char *) xrealloc(xcsv_file.badchars, strlen(xcsv_file.badchars) + strlen(p) + 1); } else { - xcsv_file.badchars = xcalloc(strlen(p) + 1, 1); + xcsv_file.badchars = (char *) xcalloc(strlen(p) + 1, 1); } strcat(xcsv_file.badchars, p); @@ -238,11 +238,11 @@ xcsv_parse_style_line(const char *sbuff) /* record delimiters are always bad characters */ if (xcsv_file.badchars) { - xcsv_file.badchars = xrealloc(xcsv_file.badchars, + xcsv_file.badchars = (char *) xrealloc(xcsv_file.badchars, strlen(xcsv_file.badchars) + strlen(p) + 1); } else { - xcsv_file.badchars = xcalloc(strlen(p) + 1, 1); + xcsv_file.badchars = (char *) xcalloc(strlen(p) + 1, 1); } strcat(xcsv_file.badchars, p); @@ -295,11 +295,11 @@ xcsv_parse_style_line(const char *sbuff) p = sp; if (xcsv_file.badchars) { - xcsv_file.badchars = xrealloc(xcsv_file.badchars, + xcsv_file.badchars = (char *) xrealloc(xcsv_file.badchars, strlen(xcsv_file.badchars) + strlen(p) + 1); } else { - xcsv_file.badchars = xcalloc(strlen(p) + 1, 1); + xcsv_file.badchars = (char *) xcalloc(strlen(p) + 1, 1); } strcat(xcsv_file.badchars, p); -- 2.30.2